#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

struct ListNode
{
    int val;
    struct ListNode* next;
};


typedef struct ListNode ListNode;
struct ListNode* middleNode(struct ListNode* head) {
    ListNode* fast, * slow;
    fast = slow = head;
    while (fast && fast->next)
    {
        slow = slow->next;
        fast = fast->next->next;
    }
    return slow;
}